<%@ page language="java" import="java.util.*" pageEncoding="utf-8" %>
        <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
                <%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

                        <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
                        <html lang="en">

                        <head>
                                <title>无线点餐后台</title>

                                <link rel="stylesheet" type="text/css" href="/NetDianCan/bootstrap/css/bootstrap.css">
                                <link rel="stylesheet" type="text/css" href="/NetDianCan/css/theme.css">
                                <link rel="stylesheet" href="/NetDianCan/font-awesome/css/font-awesome.css">


                                <script src="/NetDianCan/js/jquery-1.7.2.min.js" type="text/javascript"></script>
                                <script src="/NetDianCan/bootstrap/js/bootstrap.js"></script>

                                <link rel="stylesheet" href="/NetDianCan/bootstrap/css/bootstrap-switch.css" />
                                <script src="/NetDianCan/bootstrap/js/bootstrap-switch.js"></script>


                                <!-- Demo page code -->

                                <style type="text/css">
                                        #line-chart {
                                                height: 300px;
                                                width: 800px;
                                                margin: 0px auto;
                                                margin-top: 1em;
                                        }

                                        .brand {
                                                font-family: georgia, serif;
                                        }

                                        .brand .first {
                                                color: #ccc;
                                                font-style: italic;
                                        }

                                        .brand .second {
                                                color: #fff;
                                                font-weight: bold;
                                        }
                                </style>


                        </head>

                        <body class="">
                                <!--<![endif]-->

                                <div class="navbar">
                                        <div class="navbar-inner">
                                                <ul class="nav pull-right">

                                                        <li>
                                                                <a href="#" class="hidden-phone visible-tablet visible-desktop" role="button">设置</a>
                                                        </li>
                                                        <li id="fat-menu" class="dropdown">
                                                                <a href="#" role="button" class="dropdown-toggle" data-toggle="dropdown">
                                                                        <i class="icon-user"></i>${user.username}
                                                                        <i class="icon-caret-down"></i>
                                                                </a>

                                                                <ul class="dropdown-menu">
                                                                        <li class="divider"></li>
                                                                        <li>
                                                                                <a tabindex="-1" href="/NetDianCan/views/login.jsp">退出</a>
                                                                        </li>
                                                                </ul>
                                                        </li>

                                                </ul>
                                                <a class="brand" href="/NetDianCan/views/index.jsp">
                                                        <span class="first">无线点餐</span>
                                                        <span class="second">后台</span>
                                                </a>
                                        </div>
                                </div>


                                <div class="sidebar-nav">
                                        <form class="search form-inline">
                                                <input type="text" placeholder="Search...">
                                        </form>

                                        <a href="#dashboard-menu" class="nav-header" data-toggle="collapse">
                                                <i class="icon-dashboard"></i>首页</a>
                                        <ul id="dashboard-menu" class="nav nav-list collapse in">
                                                <li>
                                                        <a href="/NetDianCan/views/index.jsp">报表</a>
                                                </li>
                                                <li>
                                                        <a href="/NetDianCan/user/userList">用户管理</a>
                                                </li>
                                        </ul>

                                        <a href="#table-menu" class="nav-header" data-toggle="collapse">
                                                <i class="icon-table"></i>餐桌 </a>
                                        <ul id="table-menu" class="nav nav-list collapse">
                                                <li>
                                                        <a href="/NetDianCan/table/getTableList">餐桌管理</a>
                                                </li>
                                        </ul>

                                        <a href="#menu-menu" class="nav-header collapsed" data-toggle="collapse">
                                                <i class="icon-reorder"></i>菜谱 </a>
                                        <ul id="menu-menu" class="nav nav-list collapse">
                                                <li>
                                                        <a href="/NetDianCan/menu/menulist">菜谱管理</a>
                                                </li>
                                        </ul>

                                        <a href="#order-menu" class="nav-header" data-toggle="collapse">
                                                <i class="icon-th-large"></i>订单</a>
                                        <ul id="order-menu" class="nav nav-list collapse">
                                                <li>
                                                        <a href="/NetDianCan/order/orderlist">订单管理</a>
                                                </li>
                                        </ul>
                                        <a href="#class-menu" class="nav-header" data-toggle="collapse">

                                                <i class="icon-th-large"></i>分类</a>

                                        <ul id="class-menu" class="nav nav-list collapse">
                                                <li>
                                                        <a href="/NetDianCan/menu/class">菜品分类管理</a>
                                                </li>
                                        </ul>
                                        <a href="#purchase-menu" class="nav-header" data-toggle="collapse">

                                                <i class="icon-th-large"></i>进货</a>

                                        <ul id="purchase-menu" class="nav nav-list collapse">
                                                <li>
                                                        <a href="/NetDianCan/purchase/purchase">进货记录</a>
                                                </li>
                                        </ul>

                                </div>

                                <!-- 内容 开始 -->
                                <div class="content">

                                        <!-- 提示框1 -->
                                        <div id="myModal" class="modal hide fade">
                                                <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                        <h3>警告</h3>
                                                </div>
                                                <div class="modal-body">
                                                        <p>你确定要删除吗？</p>
                                                </div>
                                                <div class="modal-footer">
                                                        <a href="#" class="btn" data-dismiss="modal" aria-hidden="true">关闭</a>
                                                        <a id="delbtn2" href="#" class="btn btn-primary"> 确 认</a>
                                                </div>
                                        </div>
                                        <!-- 提示框2 -->
                                        <div id="addModal" class="modal hide fade">
                                                <div class="modal-header">
                                                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                                                        <h3>请输入说明和花费：</h3>
                                                </div>
                                                <div class="modal-body">
                                                        <form action="/NetDianCan/user/addUser" method="post">
                                                                用户名：
                                                                <input type="text" name="user.username" class="input-block-level"> 密码：
                                                                <input type="text" name="user.password" class="input-block-level">姓名：
                                                                <input type="text" name="user.name" class="input-block-level">
                                                </div>
                                                <div class="modal-footer">
                                                        <a href="#" class="btn" data-dismiss="modal" aria-hidden="true">取 消
                                                        </a>
                                                        <button type="submit" class="btn btn-primary">添 加</button>
                                                </div>
                                                </form>
                                        </div>

                                        <div class="header">

                                                <h1 class="page-title">餐桌</h1>
                                        </div>

                                        <ul class="breadcrumb">
                                                <li>
                                                        <a href="/NetDianCan/table/getTableList">餐桌</a>
                                                        <span class="divider">/</span>
                                                </li>
                                                <li class="active">餐桌查询</li>
                                        </ul>

                                        <div class="container-fluid">
                                                <div class="row-fluid">

                                                        <div class="row-fluid">
                                                                <div class="btn-toolbar">
                                                                        <a href="#addModal" role="button" class="btn btn-primary" data-toggle="modal">
                                                                                <i class="icon-plus"></i> 添 加
                                                                        </a>
                                                                        <div class="btn-group"></div>
                                                                </div>
                                                                <c:if test="${addtable=='yes'}">

                                                                        <div class="alert alert-info">
                                                                                <button type="button" class="close" data-dismiss="alert">×</button>
                                                                                <strong>小提示：</strong> 添加成功！！
                                                                        </div>
                                                                </c:if>
                                                        </div>
                                                        <div class="well">
                                                                <table class="table table-striped table-bordered bootstrap-datatable datatable">
                                                                        <thead>
                                                                                <tr>
                                                                                        <th>编号</th>
                                                                                        <th>用户名</th>
                                                                                        <th>密码</th>
                                                                                        <th>姓名</th>
                                                                                        <th style="width: 26px;"></th>
                                                                                </tr>
                                                                        </thead>
                                                                        <tbody>
                                                                                <c:forEach items="${userList}" var="tbl">
                                                                                        <tr>
                                                                                                <td>${tbl.id}</td>
                                                                                                <td>${tbl.username}</td>
                                                                                                <td>${tbl.password}</td>
                                                                                                <td>${tbl.name}</td>
                                                                                        </tr>
                                                                                </c:forEach>
                                                                        </tbody>
                                                                </table>
                                                        </div>

                                                        <footer>
                                                                <hr>
                                                                <p class="pull-right ">
                                                                </p>
                                                        </footer>
                                                </div>
                                        </div>
                                </div>


                                <script type="text/javascript ">
                                        /*
                                                                                                                                                                                                                                                                                                                                                            $(document).ready(function(){
                                                                                                                                                                                                                                                                                                                                                            $("#delbtn ").click(function(){
                                                                                                                                                                                                                                                                                                                                                            var delid=$("#delbtn ").attr("delid ");
                                                                                                                                                                                                                                                                                                                                                            $("#myModal ").modal("show ").on("shown ", function () {
                                                                                                                                                                                                                                                                                                                                                            var delurl="/NetDianCan/TableServlet?delid="+delid;
                                                                                                                                                                                                                                                                                                                                                            $(" #delbtn2 ").attr('href',delurl);
                                                                                                                                                                                                                                                                                                                                                            });
                                                                                                                                                                                                                                                                                                                                                            });

                                                                                                                                                                                                                                                                                                                                                            });
                                                                                                                                                                                                                                                                                                                                                            */

                                        var xmlhttp;
                                        $('.make-switch').on('switch-change', function (e, data) {
                                                //创建xmlHttp
                                                createXMLHttpRequest();

                                                var url = "/NetDianCan/table/changeTableFlag?tid=" + $(
                                                        this).attr('id');

                                                xmlhttp.onreadystatechange = state_Change;
                                                xmlhttp.open(" POST ", url, true);
                                                xmlhttp.send(null);
                                        })

                                        function createXMLHttpRequest() {
                                                if (window.XMLHttpRequest) { // code for IE7, Firefox, Opera, etc.
                                                        xmlhttp = new XMLHttpRequest();
                                                } else if (window.ActiveXObject) { // code for IE6, IE5
                                                        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP ");
                                                }
                                        }

                                        //处理返回结果
                                        function state_Change() {
                                                if (xmlhttp.readyState == 4) {
                                                        if (xmlhttp.status == 200) {

                                                        }
                                                }
                                        }

                                        function del(obj) {
                                                var delid = $(obj).attr("delid ");
                                                var pNow = $(obj).attr("pNow ");
                                                var delurl = "/NetDianCan/table/delTable?table.id=" + delid +
                                                        " &pageNow=" + pNow;
                                                $(" #myModal ").modal("show ").on("shown ", function () {
                                                        $("#delbtn2 ").attr('href', delurl);
                                                });
                                        }
                                </script>
                        </body>

                        </html>